package cn.iocoder.yudao.module.call.mq.producer.task;

import cn.iocoder.yudao.module.call.mq.message.task.CallTaskNumberMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 录音转文字 Post Producer
 */
@Slf4j
@Component
public class CallTaskNumberProducer {

    @Resource
    private ApplicationContext applicationContext;

    /**
     * 发送 {@link CallTaskNumberMessage} 消息
     */
    public void sendCallTaskNumberMessage(String taskId, List<String> numberList,Long tenantId) {
        // 只有数量大于0，才会发送日志去计费
        CallTaskNumberMessage message = new CallTaskNumberMessage();
        message.setTaskId(taskId);
        message.setCalleeList(numberList);
        message.setTenantId(tenantId);
        applicationContext.publishEvent(message);

    }

}
